home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
090
/
byt86sep.arc
/
BREAKPT.ASM
next >
Wrap
Assembly Source File
|
1986-04-21
|
2KB
|
118 lines
; BREAKPT
; Copyright 1985, Edward Batutis
;
; Invokes the breakpoint interrupt when Ctrl-Shift-Shift
; combination is pressed.
; Assembled with the IBM Macro Assembler Version 1.00
cseg segment para public 'code'
assume cs:cseg,ds:cseg
org 100h
breakpt proc
jmp install
copyright db 'BREAKPT (c) Copyright 1985,'
db ' Edward J. Batutis',01ah
old_int9_vector label dword
old_int9_offs dw ?
old_int9_seg dw ?
new_int9:
; call old keyboard routine by simulating an int
pushf
call cs:old_int9_vector
push es ; save registers
push ax
push bx
mov ax,40h ; look at keyboard flag1 in
mov es,ax ; ROM BIOS data area
mov bx,17h
mov al,es:[bx]
and al,07h ; mask off everything but lowest
; three bits
cmp al,7 ; are Ctrl-Shift-Shift depressed?
jne quit ; no, quit
; turn on the trap flag
pop bx ; restore registers
pop ax
pop es
push ax ; save register
pushf ; get flags into ax
pop ax
or ax,0100h ; set trap flag on
push ax ; put new flags back
popf
pop ax ; restore ax
nop ; wait one instruction
iret ; debug is invoked at this instruction
quit:
pop bx ; restore registers when
pop ax ; quitting
pop es
done:
iret
END_OF_RESIDENT_CODE LABEL BYTE
banner db 'BREAKPT installed.',10,13,'$'
install:
; get interrupt vector for
; keyboard interrupt
mov ah,35h ; get interrupt vector function
mov al,9 ; get interrupt 9
int 21h
cmp bx,offset new_int9 ; are we already installed?
je no_install ; yes, just exit
mov old_int9_offs,bx ; save old keyboard interrupt
mov old_int9_seg,es ; address
mov dx,offset banner ; print banner
mov ah,9 ; print string function
int 21h
; set keyboard interrupt
; to point to new_int9
mov ah,25h ; set interrupt function
mov al,9 ; set interrupt 9
mov dx,offset new_int9 ; point to new routine
int 21h
; terminate, but stay
; partially resident
; point to last byte of resident
; routines+1
mov dx,offset END_OF_RESIDENT_CODE+1
int 27h
no_install:
int 20h ; don't install, just exit
breakpt endp
cseg ends
end breakpt
_OF_RESIDENT_CODE+1
int 27h
no_install:
int 20h ; don't install, just exit
breakpt end